package com.firebird.oms.domain.sm;

// Generated 2008-6-17 9:48:59 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * TismRegion generated by hbm2java
 */
@Entity
@Table(name = "tism_region")
public class TismRegion implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Integer nodeId;
	private String nodeName;
	private Integer nodeType;
	private Integer upperNodeId;
	private Integer upperId;
	private Set<TismRegion> children = new HashSet<TismRegion>();

	public TismRegion() {
	}

	public TismRegion(Integer id, Integer nodeId, Integer nodeType) {
		this.id = id;
		this.nodeId = nodeId;
		this.nodeType = nodeType;
	}

	public TismRegion(Integer id, Integer nodeId, String nodeName, Integer nodeType, Integer upperNodeId, Integer upperId) {
		this.id = id;
		this.nodeId = nodeId;
		this.nodeName = nodeName;
		this.nodeType = nodeType;
		this.upperNodeId = upperNodeId;
		this.upperId = upperId;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "node_id", nullable = false)
	public Integer getNodeId() {
		return this.nodeId;
	}

	public void setNodeId(Integer nodeId) {
		this.nodeId = nodeId;
	}

	@Column(name = "node_name", length = 128)
	public String getNodeName() {
		return this.nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	@Column(name = "node_type", nullable = false)
	public Integer getNodeType() {
		return this.nodeType;
	}

	public void setNodeType(Integer nodeType) {
		this.nodeType = nodeType;
	}

	@Column(name = "upper_node_id")
	public Integer getUpperNodeId() {
		return this.upperNodeId;
	}

	public void setUpperNodeId(Integer upperNodeId) {
		this.upperNodeId = upperNodeId;
	}

	@Column(name = "upper_id")
	public Integer getUpperId() {
		return this.upperId;
	}

	public void setUpperId(Integer upperId) {
		this.upperId = upperId;
	}

	@Transient
	public Set<TismRegion> getChildren() {
		return children;
	}

	public void setChildren(Set<TismRegion> children) {
		this.children = children;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof TismRegion)) {
			return false;
		}
		TismRegion rhs = (TismRegion) object;
		return new EqualsBuilder().appendSuper(super.equals(object)).append(this.upperId, rhs.upperId).append(
				this.nodeId, rhs.nodeId).append(this.nodeName, rhs.nodeName).append(this.nodeType, rhs.nodeType)
				.append(this.children, rhs.children).append(this.upperNodeId, rhs.upperNodeId).append(this.id, rhs.id)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(79600431, 243995233).appendSuper(super.hashCode()).append(this.upperId).append(
				this.nodeId).append(this.nodeName).append(this.nodeType).append(this.children).append(this.upperNodeId)
				.append(this.id).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("nodeId", this.nodeId).append("id", this.id).append("upperId",
				this.upperId).append("nodeType", this.nodeType).append("children", this.children).append("upperNodeId",
				this.upperNodeId).append("nodeName", this.nodeName).toString();
	}

}
